import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int[] arr=new int[100001];
        arr[0]=1;
        arr[1]=1;
        for(int i=2;i<arr.length;i++)
        {
            arr[i]=(arr[i-1]+arr[i-2])%1000000;
        }
        while (in.hasNextInt()) {
            int n = in.nextInt();
            if(n<29)
            {
                System.out.println(arr[n]);
            }
            else
            {
                System.out.printf("%6d\n",arr[n]);
            }
        }
    }
}
